package com.fourth.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fourth.dao.HeadNavDao;
import com.fourth.service.HeadNavService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ljx.entity.HeadNav;
import com.ljx.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author：lmy
 * @Date：2023/2/27 15:44
 */
@Service
public class HeadNavServiceImpl extends ServiceImpl<HeadNavDao, HeadNav> implements HeadNavService {
    @Autowired(required = false)
    private HeadNavDao headNavDao;

    @Override
    public Result fuzzySearch(Integer currentPage, Integer pageSize, HeadNav headNav) {

        Page<HeadNav> page = new Page<>(currentPage,pageSize);
        QueryWrapper<HeadNav> wrapper = new QueryWrapper<>();
        if (headNav.getHeadName() != ""){
            wrapper.like("head_name",headNav.getHeadName());
        }
        if (headNav.getIsDisable() != ""){
            wrapper.like("is_disable",headNav.getIsDisable());
        }
        wrapper.eq("is_deleted",0);
        Page<HeadNav> headNavPage = headNavDao.selectPage(page, wrapper);
        return new Result(2000,"查询成功",headNavPage);


    }
}
